<%@ page contentType="text/html;charset=UTF-8" language="java" isErrorPage="true" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="th" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>我的订单</title>
    <link href="${pageContext.request.contextPath}/css/myorder/myorder_center.css" rel="stylesheet">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/dist/layui/css/layui.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/dist/jquery-3.6.0.min.js" rel="stylesheet"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/dist/bootstrap-3.4.1-dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/dist/bootstrap-3.4.1-dist/js/bootstrap.min.js">
    <script>
        var customer = '<%=request.getSession().getAttribute("loginCustomer")%>';
        console.log("++++++++++++++++++++++" + customer);
        let custId = '${loginCustomer.custId}';
        console.log("custId:" + custId);
        if (custId == null){
            custId = ${custId};
            console.log("=========================" + custId);
        }
    </script>
    <style>
        button:focus{
            border:none !important;
            outline:none !important;
        }

        .modal-backdrop.in {
            filter: alpha(opacity=50);
            opacity: .5;
            visibility: hidden !important;
        }
    </style>
</head>
<body>

<!--====================头部导航条==================================-->
<div class="topBarC">
    <div class="logo">
        <a href="${pageContext.request.contextPath}/index.jsp" title="首页">首页</a>
    </div>

    <div class="t_nav">
        <ul class="t_nav_ul">
            <li>
                <strong class="t">
                    <a href="${pageContext.request.contextPath}/index.jsp">首页</a>
                </strong>
            </li>

            <li>
                <strong class="t">
                    <a href="${pageContext.request.contextPath}/destination/destination_index.jsp">目的地</a>
                </strong>
            </li>

            <li>
                <strong class="t">
                    <a href="">自友行</a>
                </strong>
            </li>

            <li>
                <strong class="t">
                    <a href="">旅游定制</a>
                </strong>
            </li>

            <li>
                <strong class="t">
                    <a href="">游记社区</a>
                </strong>
            </li>


        </ul>
    </div>

    <div class="t_search">
        <form method="get" name="search">
            <input type="text" class="key">
            <input type="submit" class="btn" value="">
        </form>
    </div>

</div>

<!--====================头部背景图===================================-->
<div class="container">
    <div class="banner">
        <div class="banner_img banner_extra"></div>
    </div>
</div>

<!--====================背景图底部个人中心列表============================-->
<div class="tags_bar second_tags_bar" style="z-index: 0">
    <div class="center">
        <div class="Mavater">
            <div class="MAvaImg flt1">
                <img width="120px" height="120px" src="http://p1-q.mafengwo.net/s12/M00/35/6C/wKgED1uqIpCARLIhAAAZUeRPlFM676.png?imageMogr2%2Fthumbnail%2F%21120x120r%2Fgravity%2FCenter%2Fcrop%2F%21120x120%2Fquality%2F90"/>
            </div>
        </div>
        <ul class="flt2">

            <li>
                <a href="${pageContext.request.contextPath}/customer/customermain.jsp"  class="tags_link">我的沃</a>
            </li>
            <li>
                <a href="${pageContext.request.contextPath}/myorder/myorder_center.jsp"  class="tags_link">我的订单</a>
            </li>
            <li>
                <a href="${pageContext.request.contextPath}/customer/customer_notes.jsp"  class="tags_link">我的游记</a>
            </li>
            <li>
<%--                <a href="${pageContext.request.contextPath}/customer/customer_review.jsp"  class="tags_link">我的评价</a>--%>
            </li>
            <li>
                <a href="${pageContext.request.contextPath}/customer/customer_collection.jsp"  class="tags_link">我的收藏</a>
            </li>
        </ul>
    </div>

</div>

<!--=====================底部一级列表及对应的二级列表=====================-->
<div class="wrapper">


    <!-- Modal -->
    <div class="modal" id="myModal" tabindex="-1" style="z-index: 100" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content" style="z-index: 1000">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">订单点评</h4>
                </div>
                <div class="modal-body">
                    <input type="hidden" value=" ' + myorderNo + ' "/>
                    <textarea class="form-control" id="deblock_udid" name="deblock_udid" rows="16" style="min-width: 90%"></textarea>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" onclick="he()" data-dismiss="modal">评价</button>
                </div>
            </div>
        </div>
    </div>


    <div class="home-extra">
        <div class="s-menu">
            <ul class="filter clearfix">

                <li>
                    <a href="${pageContext.request.contextPath}/myorder/myorder_center.jsp" class="tags_link">我的订单</a>
                </li>
                <li>
                    <a href="${pageContext.request.contextPath}/customer/customer_notes.jsp" class="tags_link">我的游记</a>
                </li>
                <li>
<%--                    <a href="${pageContext.request.contextPath}/customer/customer_review.jsp" class="tags_link">我的评价</a>--%>
                </li>
                <li>
                    <a href="${pageContext.request.contextPath}/customer/customer_collection.jsp" class="tags_link">我的收藏</a>
                </li>
            </ul>
        </div>

        <div class="layui-tab">
            <ul class="layui-tab-title">
                <li class="layui-this">全部</li>
                <li>待支付</li>
                <li>待出行</li>
                <li>待评价</li>
                <li>取消/退款</li>
            </ul>

            <%--=================================全部====================================--%>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="order-table" >
                        <table class="order-hd">
                            <tbody>
                            <tr>
                                <th class="td-info">订单信息</th>
                                <th class="td-type">类型</th>
                                <th class="td-date">行程日期</th>
                                <th class="td-cost">支付金额</th>
                                <th class="td-status">订单状态</th>
                                <th class="td-operate">操作</th>
                            </tr>
                            </tbody>
                        </table>

                        <div class="order-bd">
                            <ul class="order-list">
<%--                                <li>--%>
<%--                                    <table data-id="75992922021100229360727" data-type="sales" class="order-item">--%>
<%--                                        <caption>--%>
<%--                                    <span class="num">--%>
<%--                                        订单号:--%>
<%--                                        <a href="" target="_blank">75992922021100229362919</a>--%>
<%--                                    </span>--%>

<%--                                            <span class="time">下单时间：2021-10-02 11:41:40</span>--%>
<%--                                        </caption>--%>
<%--                                        <tbody>--%>
<%--                                        <tr>--%>
<%--                                            <td class="td-info">--%>
<%--                                                <a class="pro-img" href="" target="_blank">--%>
<%--                                                    <img src="http://t1-q.mafengwo.net/s15/M00/FE/B8/CoUBGV4FoLmAEkQkAAeigkP4oec38.jpeg?imageMogr2%2Fthumbnail%2F%21140x140r%2Fgravity%2FCenter%2Fcrop%2F%21140x140%2Fquality%2F90">--%>
<%--                                                </a>--%>
<%--                                                <div class="pro-detail">--%>
<%--                                                    <p class="title" title="【国庆特惠】苏州沧浪亭门票  经典园林 苏州景点  苏州门票  随订随用  ">--%>
<%--                                                        <a href="" target="_blank">【国庆特惠】苏州沧浪亭门票  经典园林 苏州景点  苏州门票  随订随用  </a>--%>
<%--                                                    </p>--%>
<%--                                                    <p class="sub" title="门票 x 1">门票 x 1</p>--%>
<%--                                                </div>--%>
<%--                                            </td>--%>
<%--                                            <td class="td-type">门票</td>--%>
<%--                                            <td class="td-date">--%>
<%--                                                <p>使用日期(当地时间)：2021-10-31</p>--%>
<%--                                            </td>--%>
<%--                                            <td class="td-cost">--%>
<%--                                                <strong>￥15.00</strong>--%>
<%--                                            </td>--%>
<%--                                            <td class="td-status">--%>
<%--                                                <p class="s2">待支付</p>--%>
<%--                                            </td>--%>
<%--                                            <td class="td-operate">--%>
<%--                                                <a href="${pageContext.request.contextPath}/myorder/order_details.jsp" target="_blank">查看订单</a>--%>
<%--                                                <form name="form1" action="<%=request.getContextPath() %>/ali/pay" method="post">--%>
<%--                                                    <input type="hidden" name="orderId" value="bbbee58b27dc4bf682d8719"/>--%>
<%--                                                    <input type="hidden" name="productName" value="景点门票"/>--%>
<%--                                                    <input type="hidden" name="myorderPrice" value="20.0"/>--%>
<%--                                                    <a class="btn" href="javascript:document.form1.submit();">去支付</a>--%>
<%--                                                </form>--%>
<%--                                            </td>--%>

<%--                                        </tr>--%>
<%--                                        </tbody>--%>
<%--                                    </table>--%>
<%--                                </li>--%>
                            </ul>
                        </div>
                    </div>
                    <!--                        1. 高度默认自适应，也可以随意固宽。-->
                    <!--                        <br>2. Tab进行了响应式处理，所以无需担心数量多少。-->
                </div>

                <%--===============================待支付======================================--%>
                <div class="layui-tab-item">
                    <div class="order-table">
                        <table class="order-hd">
                            <tbody>
                            <tr>
                                <th class="td-info">订单信息</th>
                                <th class="td-type">类型</th>
                                <th class="td-date">行程日期</th>
                                <th class="td-cost">支付金额</th>
                                <th class="td-status">订单状态</th>
                                <th class="td-operate">操作</th>
                            </tr>
                            </tbody>
                        </table>

                        <div class="order-bd">
                            <ul class="order-list">
<%--                                <li>--%>
<%--                                    <table data-id="75992922021100229360727" data-type="sales" class="order-item">--%>
<%--                                        <caption>--%>
<%--                                    <span class="num">--%>
<%--                                        订单号:--%>
<%--                                        <a href="" target="_blank">75992922021100229362919</a>--%>
<%--                                    </span>--%>

<%--                                            <span class="time">下单时间：2021-10-02 11:41:40</span>--%>
<%--                                        </caption>--%>
<%--                                        <tbody>--%>
<%--                                        <tr>--%>
<%--                                            <td class="td-info">--%>
<%--                                                <a class="pro-img" href="" target="_blank">--%>
<%--                                                    <img src="http://t1-q.mafengwo.net/s15/M00/FE/B8/CoUBGV4FoLmAEkQkAAeigkP4oec38.jpeg?imageMogr2%2Fthumbnail%2F%21140x140r%2Fgravity%2FCenter%2Fcrop%2F%21140x140%2Fquality%2F90">--%>
<%--                                                </a>--%>
<%--                                                <div class="pro-detail">--%>
<%--                                                    <p class="title" title="【国庆特惠】苏州沧浪亭门票  经典园林 苏州景点  苏州门票  随订随用  ">--%>
<%--                                                        <a href="" target="_blank">【国庆特惠】苏州沧浪亭门票  经典园林 苏州景点  苏州门票  随订随用  </a>--%>
<%--                                                    </p>--%>
<%--                                                    <p class="sub" title="门票 x 1">门票 x 1</p>--%>
<%--                                                </div>--%>
<%--                                            </td>--%>
<%--                                            <td class="td-type">门票</td>--%>
<%--                                            <td class="td-date">--%>
<%--                                                <p>使用日期(当地时间)：2021-10-31</p>--%>
<%--                                            </td>--%>
<%--                                            <td class="td-cost">--%>
<%--                                                <strong>￥15.00</strong>--%>
<%--                                            </td>--%>
<%--                                            <td class="td-status">--%>
<%--                                                <p class="s2">待支付</p>--%>
<%--                                            </td>--%>
<%--                                            <td class="td-operate">--%>
<%--                                                <a href="" target="_blank">查看订单</a>--%>
<%--                                                <a  class="btn" href="" target="_blank">去支付</a>--%>
<%--                                            </td>--%>

<%--                                        </tr>--%>
<%--                                        </tbody>--%>
<%--                                    </table>--%>
<%--                                </li>--%>
                            </ul>
                        </div>
                    </div>
                </div>

            <%--=======================================待出行=============================================--%>
                <div class="layui-tab-item">
                    <div class="order-table">

                        <div class="order-empty">
                            <i class="order-emp-icon"></i>
                            <p>暂无相关订单</p>
                        </div>

                        <table class="order-hd">
                            <tbody>
                            <tr>
                                <th class="td-info">订单信息</th>
                                <th class="td-type">类型</th>
                                <th class="td-date">行程日期</th>
                                <th class="td-cost">支付金额</th>
                                <th class="td-status">订单状态</th>
                                <th class="td-operate">操作</th>
                            </tr>
                            </tbody>
                        </table>


                        <div class="order-bd">
                            <ul class="order-list">
                                
                                <li>
                                    <table data-id="75992922021100229360727" data-type="sales" class="order-item">
                                        <caption>
                                    <span class="num">
                                        订单号:
                                        <a href="" target="_blank">75992922021100229362919</a>
                                    </span>

                                            <span class="time">下单时间：2021-10-02 11:41:40</span>
                                        </caption>
                                        <tbody>
                                        <tr>
                                            <td class="td-info">
                                                <a class="pro-img" href="" target="_blank">
                                                    <img src="http://t1-q.mafengwo.net/s15/M00/FE/B8/CoUBGV4FoLmAEkQkAAeigkP4oec38.jpeg?imageMogr2%2Fthumbnail%2F%21140x140r%2Fgravity%2FCenter%2Fcrop%2F%21140x140%2Fquality%2F90">
                                                </a>
                                                <div class="pro-detail">
                                                    <p class="title" title="【国庆特惠】苏州沧浪亭门票  经典园林 苏州景点  苏州门票  随订随用  ">
                                                        <a href="" target="_blank">【国庆特惠】苏州沧浪亭门票  经典园林 苏州景点  苏州门票  随订随用  </a>
                                                    </p>
                                                    <p class="sub" title="门票 x 1">门票 x 1</p>
                                                </div>
                                            </td>
                                            <td class="td-type">门票</td>
                                            <td class="td-date">
                                                <p>使用日期(当地时间)：2021-10-31</p>
                                            </td>
                                            <td class="td-cost">
                                                <strong>￥15.00</strong>
                                            </td>
                                            <td class="td-status">
                                                <p class="s2">待支付</p>
                                            </td>
                                            <td class="td-operate">
                                                <a href="" id="check-order" data-order_no = "75992922021101329510390" target="_blank">查看订单</a>
                                                <a href="${pageContext.request.contextPath}/myorder/' + myorderNo +'"  data-order_no = " ' + myorderNo + ' " target="_blank">查看订单</a>'
                                                <a class="btn" href="${pageContext.request.contextPath}/ali/pay?orderId='+ myorderNo + ' "&productName=" '+ 景点门票 +' "&myorderPrice=" '+ myorderPrice +' " target="_blank">去支付</a>
                                            </td>

                                        </tr>
                                        </tbody>
                                    </table>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>

                <%--==================================待评价=====================================--%>
                <div class="layui-tab-item">
                    <div class="order-table">

                        <div class="order-empty">
                            <i class="order-emp-icon"></i>
                            <p>暂无相关订单</p>
                        </div>

                        <table class="order-hd">
                            <tbody>
                            <tr>
                                <th class="td-info">订单信息</th>
                                <th class="td-type">类型</th>
                                <th class="td-date">行程日期</th>
                                <th class="td-cost">支付金额</th>
                                <th class="td-status">订单状态</th>
                                <th class="td-operate">操作</th>
                            </tr>
                            </tbody>
                        </table>


                        <div class="order-bd">
                            <ul class="order-list">

                            </ul>
                        </div>



                    </div>
                </div>

                <%--==================================待退款=====================================--%>
                <div class="layui-tab-item">
                    <div class="order-table">

                        <div class="order-empty">
                            <i class="order-emp-icon"></i>
                            <p>暂无相关订单</p>
                        </div>

                        <table class="order-hd">
                            <tbody>
                            <tr>
                                <th class="td-info">订单信息</th>
                                <th class="td-type">类型</th>
                                <th class="td-date">行程日期</th>
                                <th class="td-cost">支付金额</th>
                                <th class="td-status">订单状态</th>
                                <th class="td-operate">操作</th>
                            </tr>
                            </tbody>
                        </table>


                        <div class="order-bd">
                            <ul class="order-list">

                                <li>
                                    <table data-id="75992922021100229360727" data-type="sales" class="order-item">
                                        <caption>
                                    <span class="num">
                                        订单号:
                                        <a href="" target="_blank">75992922021100229362919</a>
                                    </span>

                                            <span class="time">下单时间：2021-10-02 11:41:40</span>
                                        </caption>
                                        <tbody>
                                        <tr>
                                            <td class="td-info">
                                                <a class="pro-img" href="" target="_blank">
                                                    <img src="http://t1-q.mafengwo.net/s15/M00/FE/B8/CoUBGV4FoLmAEkQkAAeigkP4oec38.jpeg?imageMogr2%2Fthumbnail%2F%21140x140r%2Fgravity%2FCenter%2Fcrop%2F%21140x140%2Fquality%2F90">
                                                </a>
                                                <div class="pro-detail">
                                                    <p class="title" title="【国庆特惠】苏州沧浪亭门票  经典园林 苏州景点  苏州门票  随订随用  ">
                                                        <a href="" target="_blank">【国庆特惠】苏州沧浪亭门票  经典园林 苏州景点  苏州门票  随订随用  </a>
                                                    </p>
                                                    <p class="sub" title="门票 x 1">门票 x 1</p>
                                                </div>
                                            </td>
                                            <td class="td-type">门票</td>
                                            <td class="td-date">
                                                <p>使用日期(当地时间)：2021-10-31</p>
                                            </td>
                                            <td class="td-cost">
                                                <strong>￥15.00</strong>
                                            </td>
                                            <td class="td-status">
                                                <p class="s2">已关闭</p>
                                            </td>
                                            <td class="td-operate">
                                                <form th:action="${pageContext.request.contextPath}/delete/ '+ myorderNo +'" method="post">
                                                    <input type="hidden" name="_method" value="DELETE">
                                                    <input type="submit" style="background-color: transparent;border: none;cursor: pointer" value="删除订单">
                                                </form>
                                                <a href="" target="_blank">查看订单</a>
                                                <a href="" target="_blank">重新预定</a>
                                            </td>

                                        </tr>
                                        </tbody>
                                    </table>
                                </li>
                            </ul>
                        </div>
                    </div>
                    
                </div>
            </div>
        </div>

    </div>
</div>

<script src="${pageContext.request.contextPath}/js/myorder/myorder_center.js"></script>
<script src="${pageContext.request.contextPath}/dist/layui/layui.js" charset="utf-8"></script>

<script>

    layui.use('element', function(){
        var $ = layui.jquery
            ,element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块

        //触发事件
        var active = {
            tabAdd: function(){
                //新增一个Tab项
                element.tabAdd('demo', {
                    title: '新选项'+ (Math.random()*1000|0) //用于演示
                    ,content: '内容'+ (Math.random()*1000|0)
                    ,id: new Date().getTime() //实际使用一般是规定好的id，这里以时间戳模拟下
                })
            }
            ,tabDelete: function(othis){
                //删除指定Tab项
                element.tabDelete('demo', '44'); //删除：“商品管理”


                othis.addClass('layui-btn-disabled');
            }
            ,tabChange: function(){
                //切换到指定Tab项
                element.tabChange('demo', '22'); //切换到：用户管理
            }
        };

        $('.site-demo-active').on('click', function(){
            var othis = $(this), type = othis.data('type');
            active[type] ? active[type].call(this, othis) : '';
        });

        //Hash地址的定位
        var layid = location.hash.replace(/^#test=/, '');
        element.tabChange('test', layid);

        element.on('tab(test)', function(elem){
            location.hash = 'test='+ $(this).attr('lay-id');
        });

    });
</script>


<script>

    <%--var customer = '<%=request.getSession().getAttribute("loginCustomer")%>';--%>
    <%--console.log("++++++++++++++++++++++" + customer);--%>
    <%--let custId = '${loginCustomer.custId}';--%>
    <%--console.log("custId:" + custId);--%>

    //根据订单状态查询订单

    var orderStatus = $(".layui-tab-title .layui-this").text();
    console.log(orderStatus);
    var status = 5;
    console.log("url:" + "${pageContext.request.contextPath}/order/customer/" + custId +"/" + status);
    loadOrderByStatus(status);
    $(".layui-tab-title").click(function (event) {
        var ele = event.target;
        orderStatus = ele.innerText;
        console.log(orderStatus);
        if (orderStatus == "全部"){
            status = 5;
        }else if(orderStatus == "待支付"){
            status = 0;
        }else if(orderStatus == '待出行'){
            status = 1;
        }else if(orderStatus == "待评价"){
            status = 2;
        }else{
            status = 3;
        }

        console.log("status:" + status);
        console.log("url:" + "${pageContext.request.contextPath}/order/customer/" + custId +"/" + status);
        loadOrderByStatus(status);
        // console.log("================================================")
    });
    function loadOrderByStatus(status) {
        $(".order-list").html("");//清空html
        // console.log("++++++++++++++++++++++++++++++++++++++++++++++++");

        var url = "${pageContext.request.contextPath}/order/customer/" + custId +"/" + status;
        $.ajax({
            url: url,
            type: "get",
            dataType:"json",
            success:function(result) {
                if (result.code == 200){
                    console.log("result:" + result);
                    console.log("result json:" + JSON.stringify(result));
                    $(".order-hd").show();
                    $(".order-list").show();
                    $(".order-empty").hide();
                    var  myorderTraveArr = result.data;
                    //数据渲染
                    for (var i = 0;i < myorderTraveArr.length;i++){
                        var travelSightsName = myorderTraveArr[i].travelSights.travelSightsName;
                        var myorderNo = myorderTraveArr[i].myorder.myorderNo;
                        var myorderPrice = myorderTraveArr[i].myorder.myorderPrice;
                        var myorderDate = myorderTraveArr[i].myorder.myorderDate;
                        var myorderStartDate = myorderTraveArr[i].myorder.myorderStartDate;
                        var travelSightsId = myorderTraveArr[i].myorder.travelSightsId;
                        var ticketcount = myorderTraveArr[i].myorder.numberAdults + myorderTraveArr[i].myorder.numberChild;
                        var liEle = null;


                        if (myorderTraveArr[i].myorder.myorderStatus == 1){
                        //待出行li格式
                        liEle = '<li>' +
                            '     <table data-id="75992922021100229360727" data-type="sales" class="order-item">' +
                            '         <caption>' +
                            '     <span class="num">' +
                            '         订单号:' +
                            '         <a href="" target="_blank">'+ myorderNo +'</a>' +
                            '     </span>' +
                            '             <span class="time">下单时间:' + myorderDate + '</span>' +
                            '         </caption>' +
                            '         <tbody>' +
                            '         <tr>' +
                            '             <td class="td-info">' +
                            '                 <a class="pro-img" href="" target="_blank">' +
                            '                     <img src="http://t1-q.mafengwo.net/s15/M00/FE/B8/CoUBGV4FoLmAEkQkAAeigkP4oec38.jpeg?imageMogr2%2Fthumbnail%2F%21140x140r%2Fgravity%2FCenter%2Fcrop%2F%21140x140%2Fquality%2F90">' +
                            '                 </a>' +
                            '                 <div class="pro-detail">' +
                            '                     <p class="title" title=" ' + travelSightsName + '">' +
                            '                         <a href="" target="_blank"> '+ travelSightsName + '</a>' +
                            '                     </p>' +
                            '                     <p class="sub" title="门票 x '+ ticketcount +'">门票 x '+ ticketcount +'</p>' +
                            '                 </div>' +
                            '             </td>' +
                            '             <td class="td-type">门票</td>' +
                            '             <td class="td-date">' +
                            '                 <p>使用日期(当地时间)：'+ myorderStartDate +'</p>' +
                            '             </td>' +
                            '             <td class="td-cost">' +
                            '                 <strong>' + myorderPrice + '</strong>' +
                            '             </td>' +
                            '             <td class="td-status">' +
                            '                 <p class="s2">预定成功</p>' +
                            '             </td>' +
                            '             <td class="td-operate">' +
                            '                 <a href="${pageContext.request.contextPath}/myorder/' + myorderNo +'" id="check-order" data-order_no = " ' + myorderNo + ' " target="_blank">查看订单</a>' +
                            '             </td>' +
                            '         </tr>' +
                            '         </tbody>' +
                            '     </table>' +
                            ' </li>';
                        }else if (myorderTraveArr[i].myorder.myorderStatus == 0){
                            //待支付li
                            liEle = '                                <li>' +
                                '    <table data-id="75992922021100229360727" data-type="sales" class="order-item">' +
                                '        <caption>' +
                                '    <span class="num">' +
                                '        订单号:' +
                                '        <a href=""  target="_blank">'+ myorderNo +'</a>' + '</span>' +
                                '            <span class="time">下单时间:' + myorderDate + '</span>' +
                                '        </caption>' +
                                '        <tbody>' +
                                '        <tr>' +
                                '            <td class="td-info">' +
                                '                <a class="pro-img" href="" target="_blank">' +
                                '                    <img src="http://t1-q.mafengwo.net/s15/M00/FE/B8/CoUBGV4FoLmAEkQkAAeigkP4oec38.jpeg?imageMogr2%2Fthumbnail%2F%21140x140r%2Fgravity%2FCenter%2Fcrop%2F%21140x140%2Fquality%2F90">' +
                                '                </a>' +
                                '                <div class="pro-detail">' +
                                '                    <p class="title" title=" ' + travelSightsName + '">' +
                                '                        <a href="" target="_blank"> '+ travelSightsName + '</a>' +
                                '                    </p>' +
                                '                    <p class="sub" title="门票 x '+ ticketcount +'">门票 x '+ ticketcount +'</p>' +
                                '                </div>' +
                                '            </td>' +
                                '            <td class="td-type">门票</td>' +
                                '            <td class="td-date">' +
                                '                <p>使用日期(当地时间)：'+ myorderStartDate +'</p>' +
                                '            </td>' +
                                '            <td class="td-cost">' +
                                '                <strong>' + myorderPrice + '</strong>' +
                                '            </td>' +
                                '            <td class="td-status">' +
                                '                <p class="s2">待支付</p>' +
                                '            </td>' +
                                '            <td class="td-operate">' +
                                '<a href="${pageContext.request.contextPath}/myorder/' + myorderNo +'" id="check-order" data-order_no = " ' + myorderNo + ' " target="_blank">查看订单</a>' +

                                '<form name="Myform" action="<%=request.getContextPath() %>/ali/pay" method="post">' +
                                '    <input type="hidden" name="orderId" value="' + myorderNo + '"/>' +
                                '    <input type="hidden" name="productName" value="景点门票"/>' +
                                '    <input type="hidden" name="myorderPrice" value="' + myorderPrice + '"/>' +
                                '    <input type="submit" style="background-color:#38c4ff;border: none;cursor: pointer" value="去支付" />' +
                                '</form>' +
                                '            </td>' +
                                '        </tr>' +
                                '        </tbody>' +
                                '    </table>' +
                                '</li>';
                        }else if(myorderTraveArr[i].myorder.myorderStatus == 3){
                            liEle = '<li>' +
                                '    <table data-id="75992922021100229360727" data-type="sales" class="order-item">' +
                                '        <caption>' +
                                '    <span class="num">' +
                                '        订单号:' +
                                '        <a href=""  target="_blank">'+ myorderNo +'</a>' +
                                '    </span>' +
                                '            <span class="time">下单时间:' + myorderDate + '</span>' +
                                '        </caption>' +
                                '        <tbody>' +
                                '        <tr>' +
                                '            <td class="td-info">' +
                                '                <a class="pro-img" href="" target="_blank">' +
                                '                    <img src="http://t1-q.mafengwo.net/s15/M00/FE/B8/CoUBGV4FoLmAEkQkAAeigkP4oec38.jpeg?imageMogr2%2Fthumbnail%2F%21140x140r%2Fgravity%2FCenter%2Fcrop%2F%21140x140%2Fquality%2F90">' +
                                '                </a>' +
                                '                <div class="pro-detail">' +
                                '                    <p class="title" title=" ' + travelSightsName + '">' +
                                '                        <a href="" target="_blank">'+ travelSightsName + '</a>' +
                                '                    </p>' +
                                '                    <p class="sub" title="门票 x '+ ticketcount +'">门票 x '+ ticketcount +'</p>' +
                                '                </div>' +
                                '            </td>' +
                                '            <td class="td-type">门票</td>' +
                                '            <td class="td-date">' +
                                '                <p>使用日期(当地时间)：'+ myorderStartDate +'</p>' +
                                '            </td>' +
                                '            <td class="td-cost">' +
                                '                <strong>' + myorderPrice + '</strong>' +
                                '            </td>' +
                                '            <td class="td-status">' +
                                '                <p class="s2">已关闭</p>' +
                                '            </td>' +
                                '            <td class="td-operate">' +
                                '                <form action="${pageContext.request.contextPath}/delete/'+ myorderNo +'" method="post">' +
                                '                    <input type="hidden" name="_method" value="PUT">' +
                                '                    <input type="submit" style="background-color: transparent;border: none;cursor: pointer" value="删除订单">' +
                                '                </form>' +
                                '           <a href="${pageContext.request.contextPath}/myorder/' + myorderNo +'" id="check-order" data-order_no = " ' + myorderNo + ' " target="_blank">查看订单</a>' +                 '  ' +
                                // '                <a href="" target="_blank">重新预定</a>' +
                                '           <a href="${pageContext.request.contextPath}/sights/details/'+ travelSightsId +'" target="_blank">重新预定</a>' +
                                '          </td>' +
                                '        </tr>' +
                                '        </tbody>' +
                                '    </table>' +
                                '</li>';
                        }else{

                            //待点评li
                            liEle = '                         <li>' +
                                '    <table data-id="75992922021100229360727" data-type="sales" class="order-item">' +
                                '        <caption>' +
                                '    <span class="num">' +
                                '        订单号:' +
                                '        <a href=""  target="_blank">'+ myorderNo +'</a>' + '</span>' +
                                '            <span class="time">下单时间:' + myorderDate + '</span>' +
                                '        </caption>' +
                                '        <tbody>' +
                                '        <tr>' +
                                '            <td class="td-info">' +
                                '                <a class="pro-img" href="" target="_blank">' +
                                '                    <img src="http://t1-q.mafengwo.net/s15/M00/FE/B8/CoUBGV4FoLmAEkQkAAeigkP4oec38.jpeg?imageMogr2%2Fthumbnail%2F%21140x140r%2Fgravity%2FCenter%2Fcrop%2F%21140x140%2Fquality%2F90">' +
                                '                </a>' +
                                '                <div class="pro-detail">' +
                                '                    <p class="title" title=" ' + travelSightsName + '">' +
                                '                        <a href="" target="_blank"> '+ travelSightsName + '</a>' +
                                '                    </p>' +
                                '                    <p class="sub" title="门票 x '+ ticketcount +'">门票 x '+ ticketcount +'</p>' +
                                '                </div>' +
                                '            </td>' +
                                '            <td class="td-type">门票</td>' +
                                '            <td class="td-date">' +
                                '                <p>使用日期(当地时间)：'+ myorderStartDate +'</p>' +
                                '            </td>' +
                                '            <td class="td-cost">' +
                                '                <strong>' + myorderPrice + '</strong>' +
                                '            </td>' +
                                '            <td class="td-status">' +
                                '                <p class="s2">预定成功</p>' +
                                '            </td>' +
                                '            <td class="td-operate">' +
                                '<a href="${pageContext.request.contextPath}/myorder/' + myorderNo +'" id="check-order" data-order_no = " ' + myorderNo + ' " target="_blank">查看订单</a>' +
                                '<button type="button" class="btn review-btn" style="padding:initial;background-color:#38c4ff;font-size:10px" id="btn1" data-toggle="modal" data-target="#myModal">添加点评</button>'+
                                '            </td>' +
                                '        </tr>' +
                                '        </tbody>' +
                                '    </table>' +
                                '</li>' +
                                '<div class="modal" id="myModal" tabindex="-1" style="z-index: 100" role="dialog" aria-labelledby="myModalLabel">' +
                                '        <div class="modal-dialog" role="document">' +
                                '            <div class="modal-content" style="z-index: 1000">' +
                                '                <div class="modal-header">' +
                                '                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span' +
                                '                            aria-hidden="true">&times;</span></button>' +
                                '                    <h4 class="modal-title" id="myModalLabel">订单点评</h4>' +
                                '                </div>' +
                                '                <div class="modal-body">' +
                                '                    <input type="text" class="orderNo" style="visibility:hidden;" value="'+myorderNo+'"/>' +
                                '                    <textarea class="form-control" id="deblock_udid" name="deblock_udid" rows="16" style="min-width: 90%"></textarea>' +
                                '                </div>' +
                                '                <div class="modal-footer">' +
                                '                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>' +
                                '                    <button type="button" class="btn btn-primary" onclick="he()" data-dismiss="modal">评价</button>' +
                                '                </div>' +
                                '            </div>' +
                                '        </div>' +
                                '    </div>';
                        }
                        $(".order-list").append(liEle);//追加li到ul中

                    }
                }else {
                    $(".order-hd").hide();
                    $(".order-list").hide();
                    $(".order-empty").show();
                    // console.log("发生了错误");
                }

            }
        });

    }

</script>

<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>

<script>
    $(".btn-primary").click(function (event) {
        var myorderNo = $(".orderNo").val();
        console.log("value:" + $(".orderNo").val());
        var context = $(".form-control").val();
        console.log("value:" + $(".form-control").val());
        //"myorder/{myorderNo}/{content}"
        var url = "${pageContext.request.contextPath}/myorder/review";
        console.log("url:" + url);

        $.ajax({url : url,
            type: "POST",
            dataType:"json",
            data:{"myorderNo": myorderNo,"content": context},
            success:function (result) {
                console.log(result);
            }
        });
    });
</script>

<%--<script>--%>
<%--    $(function () { })--%>
<%--    function open() {--%>
<%--        //backdrop默认值为true，但是点击黑色背景也能关闭--%>
<%--        //backdrop:"staic",只能点击关闭按钮才能关闭--%>
<%--        //keyboard:true;可以按Esc关闭，flase,不能按--%>
<%--        $("#myModal").modal({ backdrop: true });--%>
<%--    }--%>

<%--    $(".btn-primary").click(function (event) {--%>
<%--        console.log("value:" + $(".form-control").val());--%>
<%--        // console.log($("#btn1").parent().parent().parent().parent().parent().first().text());--%>
<%--        console.log($("#btn1").parent().parent().parent().parent().parent().first().text());--%>
<%--        jq:$("#idname").text();--%>
<%--        $(".form-control").val("");--%>
<%--    });--%>

<%--    //模态框关闭之前可以执行其他事件--%>
<%--    function he() {--%>
<%--        alert("hello")--%>
<%--    }--%>

<%--</script>--%>
</body>
</html>

